package com.lifang.framework.beans.factory.event;

import com.lifang.framework.beans.factory.BeanFactory;
import com.lifang.framework.context.ApplicationListener;
import com.lifang.framework.context.config.ApplicationEvent;

/**
 * 简单事件广播器
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster {

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    /**
     * 广播事件
     */
    @Override
    public void multicastEvent(ApplicationEvent event) {
        for (ApplicationListener<ApplicationEvent> listener : getApplicationListeners(event)) {
            listener.onApplicationEvent(event);
        }
    }

}
